<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2018-03-02 17:14:35 apple $
*/
namespace core;
defined('BY_JYA') or exit('error');
class article{
	public function up_yingxiao($article=array(),$fromuser=0){
		$daytime=mktime(0,0,0,date('m'),date('d'),date('Y'));
		$article_rule_daynum=pdo_count('core_credit_log',array('uniacid'=>$_SESSION['uniacid'],'plugin'=>'core','tag'=>'article_'.$article['id'],'createtime >'=>$daytime),'id');
		if($article_rule_daynum>=$article['article_rule_daynum']){
			return false;	
		}
		$article_rule_allnum=pdo_count('core_credit_log',array('uniacid'=>$_SESSION['uniacid'],'plugin'=>'core','tag'=>'article_'.$article['id']),'id');
		if($article_rule_allnum>=$article['article_rule_allnum']){
			return false;	
		}
		$article_rule_money_total=pdo_getsum('core_credit_log',array('uniacid'=>$_SESSION['uniacid'],'type'=>2,'plugin'=>'core','tag'=>'article_'.$article['id']),'fee');
		if($article_rule_money_total>=$article['article_rule_money_total']){
			return false;	
		}
		if($article['article_rule_credit']){
			model()->member_credit($fromuser,'credit1',$article['article_rule_credit'],true,'core','文章分享奖励积分','article_'.$article['id']);
		}
		if($article['article_rule_money']){
			model()->member_credit($fromuser,'credit2',$article['article_rule_money'],true,'core','文章分享奖励余额','article_'.$article['id']);
		}
		return true;
	}
}